<?php
    $aPos = unserialize(ADVERTISE_POST_ARRAY);
    $lastAdvertise=array('position'=>1, 'start_date'=>'', 'end_date'=>'', 'anchor'=>'', 'content'=>'', 'publish_flg'=>1);
?>
<div class="row">
    <h1 class="col-md-6 col-xs-6">Quảng cáo</h1>
    <h1 class="col-md-6 col-xs-6">
        <a class="btn btn-default pull-right mgl5" href="<?php echo mns_page_url(ADVERTISE_SLUG); ?>">
            <i class='glyphicon glyphicon-share-alt'></i>
            Trở về
        </a>
        <button type="button" class="btn btn-success btn-submit-update pull-right" onclick="wireOfAction('#btn-new', 'click');">
            <i class='glyphicon glyphicon-plus-sign'></i>
            Thêm mới
        </button>
    </h1>

    <div class="col-md-12">
        <ol class="breadcrumb">
            <li><a href="<?php echo mns_page_url(); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="<?php echo mns_page_url(ADVERTISE_SLUG); ?>"><i class="fa fa-dashboard"></i> Quảng cáo</a></li>
            <li class="active"><i class="fa fa-table"></i> Thêm mới</li>
        </ol>
    </div>
</div>

<div class='row'>
    <h1 class="col-md-12">Thêm quảng cáo mới</h1>
    <form id="frm-advertise" role="form" method="post" action="<?php echo mns_page_url(ADVERTISE_SLUG.'/dang-ki-moi/do'); ?>" enctype="multipart/form-data">
        <div class="form-group col-md-3 col-xs-12">
            <label for="input-advertise-position">Vị trí</label>
            <select class="form-control" id="input-advertise-position" name="advertise[position]">
                <?php foreach($aPos as $key=>$ps) { ?>
                <option value="<?php echo $key; ?>" <?php echo $lastAdvertise['position']==$key?"selected='selected'":""; ?> ><?php echo $ps; ?></option>
                <?php } ?>
            </select>
        </div>
        <div class="clearfix"></div>

        <div class="form-group col-md-3 col-xs-12">
            <label for="input-advertise-start-date-1">Ngày bắt đầu</label>
            <input type="text" class="form-control input-date" id="input-advertise-start-date-1" name="advertise[start_date]" autocomplete="off" value="<?php echo $lastAdvertise['start_date']; ?>" />
        </div>

        <div class="form-group col-md-3 col-xs-12">
            <label for="input-advertise-end-date-1">Ngày kết thúc</label>
            <input type="text" class="form-control input-date" id="input-advertise-end-date-1" name="advertise[end_date]" autocomplete="off" value="<?php echo $lastAdvertise['end_date']; ?>" />
        </div>
        <div class="clearfix"></div>

        <div class="form-group col-md-6 col-xs-12">
            <label for="input-advertise-anchor">Liên kết</label>
            <input type="text" class="form-control" id="input-advertise-anchor" name="advertise[anchor]" value="<?php echo $lastAdvertise['anchor']; ?>" placeholder="http://www.example.com" />
        </div>
        <div class="clearfix"></div>

        <div class="form-group col-md-4 col-xs-12">
            <label for="input-advertise-content">Nội dung quảng cáo</label>
            <input type="file" class="form-control" id="input-advertise-content" name="userfile" accept='application/rar,application/zip' />
            <br/>
            <span class='text-danger'>* (Chỉ chấp nhận file dạng .zip hoặc .rar)</span>
        </div>

        <div class="form-group col-md-12 col-xs-12">
            <button type="submit" id="btn-new" class="btn btn-success btn-submit-update"><i class='glyphicon glyphicon-ok-sign'></i> Thêm mới</button>
            <a class="btn btn-default" href="<?php echo mns_page_url(ADVERTISE_SLUG); ?>"><i class='glyphicon glyphicon-share-alt'></i> Trở về</a>
        </div>
        <div class="clearfix"></div>
    </form>
</div>